package com.qf.homwork.controller;


import com.qf.homwork.model.IOReaderFile;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpSession;
import java.io.IOException;
import java.util.HashMap;
import java.util.Random;

@Controller
@RequestMapping("/pick")
public class ShowNameController {


    @RequestMapping("/test")
    public String chekeNames(HttpSession session) throws IOException {
        HashMap map = new IOReaderFile().readFileIO();//得到map集合

        int i = new Random().nextInt(9);
        Object o = map.get(i);
        session.setAttribute("name",o);
        return "forward:/view/user.jsp";

    }

}
